package hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import entity.*;

public class HibernateUtil {
	private static final SessionFactory sessionFactory;
	static {
		try {
			AnnotationConfiguration config = new AnnotationConfiguration();

			config.addAnnotatedClass(CuentaBD.class);
			config.addAnnotatedClass(AsientoContableBD.class);
			config.addAnnotatedClass(LineaAsientoBD.class);
			config.addAnnotatedClass(MedioPagoBD.class);
			config.addAnnotatedClass(ProveedorBD.class);
			config.addAnnotatedClass(SectorBD.class);
			config.addAnnotatedClass(SectorId.class);
			config.addAnnotatedClass(SemielaboradoBD.class);
			config.addAnnotatedClass(ProductoBD.class);
			config.addAnnotatedClass(InsumoBD.class);
			config.addAnnotatedClass(RegistroAtencionBD.class);
			config.addAnnotatedClass(RestauranteBD.class);
			config.addAnnotatedClass(MozoBD.class);
			config.addAnnotatedClass(AreaBD.class);
			config.addAnnotatedClass(DepositoBD.class);
			config.addAnnotatedClass(ItemComandaBD.class);
			config.addAnnotatedClass(ItemRecetaBD.class);
			config.addAnnotatedClass(PlatoBD.class);
			config.addAnnotatedClass(RecetaBD.class);
			config.addAnnotatedClass(ComandaBD.class);
			config.addAnnotatedClass(PuntoReposicionBD.class);
			config.addAnnotatedClass(ItemRemitoEntreDepositosBD.class);
			config.addAnnotatedClass(CartaBD.class);
			config.addAnnotatedClass(RemitoEntreDepositosBD.class);
			config.addAnnotatedClass(ItemCartaBD.class);
			config.addAnnotatedClass(ItemPedidoBD.class);
			config.addAnnotatedClass(PedidoBD.class);
			config.addAnnotatedClass(RubroBD.class);
			config.addAnnotatedClass(CocinaBD.class);
			config.addAnnotatedClass(FacturaBD.class);
			config.addAnnotatedClass(FacturaId.class);
			config.addAnnotatedClass(ItemFacturaBD.class);
			config.addAnnotatedClass(ItemFacturaId.class);
			config.addAnnotatedClass(OrdenCompraBD.class);
			config.addAnnotatedClass(ItemOrdenCompraBD.class);
			config.addAnnotatedClass(MesaBD.class);
			config.addAnnotatedClass(EstadisticaPermanenciaBD.class);
			config.addAnnotatedClass(NotaDevolucionBD.class);
			config.addAnnotatedClass(ItemDevolucionBD.class);
			config.addAnnotatedClass(RemitoDB.class);
			config.addAnnotatedClass(ItemRemitoBD.class);
			config.addAnnotatedClass(ItemOrdenProduccionBD.class);
			config.addAnnotatedClass(LiquidacionMozoBD.class);
			config.addAnnotatedClass(MovimientoStockBD.class);
			config.addAnnotatedClass(OrdenProduccionBD.class);
			config.addAnnotatedClass(ReservaMesaBD.class);
			config.addAnnotatedClass(EmpleadoBD.class);
			config.addAnnotatedClass(CajaBD.class);

			// config.addAnnotatedClass(EmpleadoBD.class);

			sessionFactory = config.buildSessionFactory();
		} catch (Throwable ex) {
			System.err.println("Initial SessionFactory creation failed." + ex);
			throw new ExceptionInInitializerError(ex);
		}
	}

	public static SessionFactory getSessionFactory() {
		return sessionFactory;
	}
}
